/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.maze.behaviours;

import java.util.Random;

/**
 *
 * @author Thomas
 */
public class SimpleMutateBehaviour implements IMutateBehaviour{
    Random rand;

    public static final byte NORTH=0;
    public static final byte SOUTH=1;
    public static final byte EAST=2;
    public static final byte WEST=3;

    public SimpleMutateBehaviour(){
        rand = new Random();
    }

    public byte[] mutate(byte[] genome) {
        byte[] temp = genome.clone();
        for(int i=0; i< temp.length; i++){
            if(rand.nextInt(1000)==10){
                int val = rand.nextInt(4);
                if(val == 0)
                    temp[i]=NORTH;
                else if(val == 1)
                    temp[i]=SOUTH;
                else if(val == 2)
                    temp[i]=EAST;
                else if(val == 3)
                    temp[i]=WEST;
            }
        }
        return temp;
    }

}
